package com.gooluke.user.controller;

import com.gooluke.common.domain.Result;
import com.gooluke.user.domain.dto.UserCreateDTO;
import com.gooluke.user.domain.vo.UserDetailVO;
import com.gooluke.user.service.UserService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

/**
 * @author gooluke
 * description
 * datetime 2025-03-28 17:44
 */
@RestController
@RequestMapping("/api/user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/detail/{id}")
    public Result<UserDetailVO> getUserDetail(@PathVariable("id") Long id) {
        return Result.success(userService.getUserDetail(id));
    }

    @PostMapping("/register")
    public Result<Object> registerUser(@Valid @RequestBody UserCreateDTO dto) {
        return userService.registerUser(dto);
    }

}
